package main

// 类型参数， 名字叫 T 约束是 any, 等于没有约束
type List[T any] interface {
	Add(idx int, t T)
	Append(t T)
}

func main() {
	//UseList()
	println(Sum[int](1,23,34,45,56))
	println(Sum[float64](1,23.6,34.8,45.32,56.12))
	println(Sum[float32](1.13,23.31,34.489,45.1,56.54))
	println(Sum[Integer]( 1,5,3,47,9))

}

func UseList() {
	//var l List[int]
	//l.Append(12)

	var lAny List[any]
	lAny.Append(12.3)
	lAny.Append(1245)
	lk := LinkedList[int]{}
	intVal := lk.head.val
	println(intVal)
}

type LinkedList[T any] struct {
	head *node[T]
	t    T
}

type node[T any] struct {
	val T
}
